<template>
    <div class="paymentvue flex">
        <Asiden></Asiden>
        <div :class="store.state ? 'body bodyw1' : 'body bodyw'">
            <Nav></Nav>
            <div class="main">
                <div class="paybox flex">
                    <div :class="state ? 'left leftw2 ml-10' : 'left leftw1 ml-10'">
                        <dl class="flex aic toplist ">
                            <dd class="item flex aic jc-c f14 " @click="change">Sumary</dd>
                            <dd class="item flex aic jc-c f14 ">Reports</dd>
                        </dl>
                        <div class="info">
                            <div class="balance">
                                <p class="f16 ">balance</p>
                                <p class="f18  mt-10">{{ utils.currencType(titleCurrent) }}{{ titleAmount }}
                                </p>
                                <div class="Available mt-20">
                                    <span class="f16  mt-10">Available</span>
                                    <dl class="moneylsit  pb-10 mt-10 ">
                                        <dd class="item flex jc-sb f15" v-for="item in moneyList">
                                            <span>{{ item.current }}</span> <span>{{ utils.currencType(item.current)
                                            }}{{ item.amount }}</span>
                                        </dd>
                                    </dl>
                                </div>
                                <span class="f13">*this is on estimate based on the most recent conversion rate</span>
                            </div>
                            <div class="bank mt-20">
                                <el-select v-model="bankID" @change="changeBank" class="m-2" placeholder="BOA BANK"
                                    size="large">
                                    <el-option v-for="item in bankList" :key="item.value" :label="item.label"
                                        :value="item.value" />
                                </el-select>
                                <div class="bankinfo mt-10">
                                    <p class="message f15">{{ bankInfo }}</p>
                                </div>
                            </div>
                            <div class="button flex">
                                <el-button @click="open" style="background-color:#6193D2;color:#ffffff">Add one
                                    Record</el-button>
                            </div>
                        </div>

                    </div>
                    <div :class="state ? 'center center1 ml-10' : 'center center2 ml-10'">
                        <div class="toplist flex jc-sb aic">
                            <span class="f14">Activity</span>
                            <div class="flex aic">
                                <div style="width: 180px; ">
                                    <el-date-picker v-model="date" @change="getdate" style="width: 100%;font-family: swis;"
                                        type="daterange" unlink-panels range-separator="-" start-placeholder="Start date"
                                        end-placeholder="End date" :shortcuts="shortcuts" size="size" />
                                </div>
                                <el-select v-model="status" clearable class="m-2 ml-10"
                                    style="width: 80px;font-family: swis;" placeholder="All">
                                    <el-option v-for="item in staList" :key="item.value" :label="item.label"
                                        :value="item.value" />
                                </el-select>
                                <el-select @clear="clearCurr" v-model="curren" clearable placeholder="All" class="m-2 ml-10"
                                    style="width: 100px;font-family: swis;">
                                    <template #empty>
                                        <div style=" border: 1px solid #f1f1f1; width: 200px;flex-direction: column;padding: 10px; "
                                            class="flex aic">
                                            <el-input @input="searMininum" style="width: 90%; font-family: swis;"
                                                class="mb-5" v-model="Minimum" placeholder="Minimum" />
                                            <el-input @input="searMaximum" style="width: 90%; font-family: swis;"
                                                class="mb-5" v-model="Maximum" placeholder="Maximum" />
                                            <hr style="width: 84%;" class="mt-5 mb-5">
                                            <el-select @change="searEntryList" style="width: 90%; font-family: swis;"
                                                v-model="curren" class="m-2 mb-5">
                                                <el-option v-for="item in currency" :key="item.value" :label="item.label"
                                                    :value="item.value" />
                                            </el-select>
                                        </div>
                                    </template>
                                </el-select>
                                <div class="ml-10">
                                    <el-button
                                        style="background-color:#ECF5FF;color: #6193D2;border:1px solid #6193D2; font-family: swis;"
                                        @click="batchAudit">BatchAudit</el-button>
                                </div>
                                <div class="ml-10">
                                    <el-button @click="download"
                                        style="background-color:#ECF5FF;color: #6193D2;border:1px solid #6193D2; font-family: swis;">Download</el-button>
                                </div>
                            </div>
                        </div>
                        <div class="table">
                            <Statement @cancelEvent="cancelEvent" @audit="audit" @SelectionMethod1="SelectionMethod1"
                                @payEdit="payEdit" @getEntryList1="getEntryList1" :entryList="entryList" />
                        </div>
                    </div>
                    <div class="right  ml-10 mr-10" v-if="state">
                        <Right :state="state" />
                    </div>
                </div>
            </div>
        </div>
        <Addone ref="addOne" @getAddList="getAddList" @getCountry="getCountry" @getAddList1="getAddList1" @addSave="addSave"
            @cancelEvent="cancelEvent" @del="del" @itemInpuAmount="itemInpuAmount" @inputFee="inputFee"
            @inputAmount="inputAmount" @selectList="SelectionMethod" @changUser="changUser" @getUser="getUser"
            @changecountry="changecountry" @seachName="seachName" @dategetAddList="dategetAddList" @getPicker="getPicker"
            @getSales="getSales" :rightList="rightList" :userList="userList" :addList="addList" :payAdd="payAdd"
            :paybankList="paybankList" :saleList="saleList" :countryList="countryList" :payTypeList="payTypeList"
            :currency="currency" :bankTypeList="bankTypeList" />
    </div>
</template>

<script setup>
import { ref, onMounted, watch } from "vue"
import { ElMessage, ElMessageBox } from 'element-plus'
import Asiden from "../components/Aside.vue"
import Nav from "../components/Nav.vue"
import Right from "../order/components/Right.vue";
import Statement from "./components/Statement.vue"
import Addone from "./components/Addone.vue"
import { useDemoStore } from '../../pinia/index'
import * as api from "../../api1/index"
import * as utils from "../order/utils"
import saveAs from 'file-saver'
import Excel from 'exceljs'

const store = useDemoStore()
const state = ref(true)

const change = () => {
    state.value = !state.value
}
/************************右侧银行信息开始********************************/
const banks = ref([])
const bankList = ref([])
const paybankList = ref([])
const bankID = ref('')
const bankInfo = ref('')
// 获取银行列表
const getBankList = () => {
    api.paymentList({ token: store.token }).then((res) => {
        banks.value = res.data.list
        paybankList.value = res.data.list && res.data.list.map(item => {
            return {
                label: item.config_short + item.config_value.slice(0, 100),
                value: item.config_id
            }
        })
        bankList.value = res.data.list && res.data.list.map((item) => {
            let label = item.config_short;
            let value = item.config_id
            return {
                label,
                value
            }
        })
        bankID.value = bankList.value[0].value
        bankInfo.value = banks.value[0].config_value
        bankmoney.config_id = bankID.value
        getEntryList()
        getbankmoney()
    })
}
// 更改银行
const changeBank = (val) => {
    bankmoney.config_id = val
    bankID.value = val
    entryData.page = 1
    getEntryList()
    getbankmoney()
    bankInfo.value = banks.value.filter(item => item.config_id == val)[0].config_value
}
const bankmoney = {
    token: store.token,
    config_id: ''
}
// 根据银行id获取银行货币存量列表和信息
const moneyList = ref([])
const titleCurrent = ref('')
const titleAmount = ref('')
const getbankmoney = () => {
    api.paymentBalance(bankmoney).then((res) => {
        moneyList.value = res.data.list && res.data.list.map(item => {
            item.amount = item.amount.toFixed(2)
            return item
        })
        titleAmount.value = moneyList.value[0].amount
        titleCurrent.value = moneyList.value[0].current
    })
}
/************************右侧银行信息结束********************************/


/***************************获取列表开始*********************************/
const entryList = ref([])
const entryData = {
    token: store.token,
    page: 1,
    rows: 20,
    config_id: '',
    start_time: '',
    end_time: '',
    Amount_min: '',
    Amount_max: '',
    payment_type: '',
    Current: ''
}
// 获取入账列表
const getEntryList = () => {
    entryData.config_id = bankID.value
    entrylistRequest()
}

const entlength = ref(1)
// 上拉加载列表
const getEntryList1 = () => {
    if (entryList.value.length == 0 || entlength.value == 0) {
        return false
    }
    entryData.page = entryData.page + 1
    api.paymentRecord(entryData).then(res => {
        entlength.value = res.data.list && res.data.list.data.length
        entryList.value = [
            ...entryList.value,
            ...res.data.list && res.data.list.data.map(item => {
                item.net = item.gross - item.fee
                item.PI_name = item.PI_name.slice(0, 10)
                return item
            })
        ]
    })
}
const entrylistRequest = () => {
    api.paymentRecord(entryData).then(res => {
        entryList.value = res.data.list && res.data.list.data.map(item => {
            item.net = item.gross - item.fee
            item.PI_name = item.PI_name.slice(0, 10)
            return item
        })
    })
}
const date = ref([])
const shortcuts = [
    {
        text: "Past 07 Days",
        value: () => {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            return [start, end];
        },
    },
    {
        text: "Past 30 Days",
        value: () => {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            return [start, end];
        },
    },
    {
        text: "Past 90 Days",
        value: () => {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            return [start, end];
        },
    },
];
// 根据时间搜索
const getdate = (val) => {
    if (!!val) {
        entryData.page = 1
        entryData.start_time = utils.ftime(new Date(val[0]).getTime())
        entryData.end_time = utils.ftime(new Date(val[1]).getTime())
        entrylistRequest()
    } else {
        entryData.start_time = ''
        entryData.end_time = ''
        entryData.page = 1
        entrylistRequest()
    }

}
const staList = [
    {
        label: 'All',
        value: '',
    },
    {
        label: 'In',
        value: 'received',
    },
    {
        label: 'Out',
        value: 'payout',
    }
]
const status = ref('')
//根据进出账搜索
// const getSatus = () => {
//     entryData.payment_type = status.value
//     api.paymentRecord(entryData).then(res => {
//         entryList.value = res.data.list && res.data.list.data
//     })
// }
watch(status, (newstat) => {
    entryData.payment_type = newstat
    entrylistRequest()
})

// 货币类型列表
const currency = ref([])
// 银行type列表
const bankTypeList = ref([])
// 支付类型
const payTypeList = ref([])
const getAddInfo = () => {
    api.ordersConfigPaymentConfi({ token: store.token }).then((res) => {
        currency.value = res.data.Current && res.data.Current.map(item => {
            return {
                label: item,
                value: item,
            }
        })
        currency.value.unshift({ label: 'All', value: '' })
        bankTypeList.value = res.data.Payment_way && res.data.Payment_way.map(item => {
            return {
                label: item,
                value: item,
            }
        })
        payTypeList.value = res.data.payment_type && res.data.payment_type.map(item => {
            return {
                label: utils.fpayType(item),
                value: item,
            }
        })
    })
}
const Minimum = ref('')
const Maximum = ref('')
const curren = ref('')
const curren1 = ref('All')
// 根据货币类型价格搜索
const searMininum = () => {
    entryData.page = 1
    entryData.Amount_min = Minimum.value
    utils.debounce(1000, () => {
        entrylistRequest()
    })
}
const searMaximum = () => {
    entryData.page = 1
    entryData.Amount_max = Maximum.value
    entryData.Amount_min = Minimum.value
    utils.debounce(1000, () => {
        entrylistRequest()
    })
}
const searEntryList = () => {
    entryData.page = 1
    entryData.Current = curren.value
    curren1.value = !curren.value ? 'All' : curren.value
    entryData.Amount_max = Maximum.value
    entryData.Amount_min = Minimum.value
    entrylistRequest()
}

const clearCurr = () => {
    entryData.Current = ''
    entryData.Amount_max = ''
    entryData.Amount_min = ''
    curren.value = ''
    Maximum.value = ''
    Minimum.value = ''
    entrylistRequest()
}
/***************************获取列表结束*********************************/

/*****************************审核开始***********************/
const selectList1 = ref([])
const SelectionMethod1 = (val) => {
    selectList1.value = val
}
const auditdata = {
    token: store.token,
    Payment_ids: []
}
// 批量审核
const batchAudit = () => {
    if (selectList1.value.length === 0) {
        ElMessage({
            type: 'info',
            message: 'There is no data for now. Data is needed for audit',
        })
        return false
    }
    ElMessageBox.confirm(
        'Whether to batch audit financial records',
        'Warning',
        {
            confirmButtonText: 'OK',
            cancelButtonText: 'Cancel',
            distinguishCancelAndClose: true,
        }
    ).then(() => {
        auditdata.Payment_ids = selectList1.value.map(item => item.Payment_id)
        pubrequest(auditdata)

    }).catch(() => {
        ElMessage({
            type: 'info',
            message: 'Audit cancellation',
        })
    })
}
// 单次审核
const audit = (val) => {
    auditdata.Payment_ids.push(val.row.Payment_id)
    pubrequest(auditdata)
}
const pubrequest = (auditdata) => {
    api.paymentProcess(auditdata).then((res) => {
        if (res.Status === 0) {
            entryList.value.forEach(item => {
                auditdata.Payment_ids.forEach(item1 => {
                    if (item.Payment_id === item1) {
                        item.Process = 1
                        item.process_text = '已审核'
                    }
                })
            })
            ElMessage({
                type: 'success',
                message: 'Successful audit',
            })
        }
    })
}
const cancelEvent = (val) => {
    ElMessage({
        type: 'info',
        message: val,
    })
}
/*****************************审核结束***********************/

/***********************************弹窗开始 **************************************/
const saveState = ref('')
const addOne = ref()
const open = () => {
    payAdd.value = {}
    rightList.value = []
    addList.value = []
    saveState.value = 'open'
    addOne.value.open = true
    payAdd.value.balance = isNaN(payAdd.value.amount - payAdd.value.total) ? '' : payAdd.value.amount - payAdd.value.total
    currency.value.shift()
}
const payAdd = ref({
    amount: '',
    fee: 0,
    sales: '',
    date: '',
    paymentWay: '',
    currency: '',
    paytype: '',
    country: '',
    bankID: '',
    rate: '',
    remarks: '',
    total: 0,
    balance: 0,
})
// 输入价格计算结余;
// 先计算总支出再计算结余;
// 总支出=手续费+每一项费用的和;
const inputAmount = () => {
    calculatePrice()
}
const inputFee = () => {
    calculatePrice()
}
// 弹窗公共计算方法
const calculatePrice = () => {
    payAdd.value.total = rightList.value.reduce((sum, item) => { return sum + item.inputNumber * 1 }, 0) + (isNaN(payAdd.value.fee * 1) ? 0 : payAdd.value.fee * 1)
    payAdd.value.total = payAdd.value.total.toFixed(2)
    payAdd.value.balance = isNaN(payAdd.value.amount - payAdd.value.total) ? '' : payAdd.value.amount - payAdd.value.total
    payAdd.value.balance = payAdd.value.balance.toFixed(2)
}
const getPicker = (val) => {
    payAdd.value.date = new Date(val).getTime()
}
// 国家列表
const countryList = ref([])
const countryData = {
    token: store.token,
    name: '',
    rows: 30,
}
const getCountry = (val) => {
    if (!val) {
        countryRequest()
    }
    countryData.name = val
    utils.debounce(500, () => {
        countryRequest()
    })
}
const countryRequest = () => {
    api.ordersConfigCountry(countryData).then(res => {
        countryList.value = res.data.data && res.data.data.map(item => {
            return {
                label: item.name,
                value: item.country_id
            }
        })
    })
}
// 获取客户列表
const userData = {
    token: store.token,
    kw: '',
    is_supplier: 0
}
const userList = ref([])
const getUser = (val) => {
    userData.kw = val
    if (!val) {
        api.orderUser(userData).then(res => {
            userList.value = res.data.data
        })
    } else {
        utils.debounce(500, () => {
            api.orderUser(userData).then(res => {
                userList.value = res.data.data
            })
        })
    }

}
//输入获取销售员列表
const saledata = {
    token: store.token,
    kw: '',
    group: 1
}
const saleList = ref([])
const getSales = (val) => {
    if (!val) {
        return false
    }
    saledata.kw = val
    utils.debounce(500, () => {
        api.ordersConfigGetUser(saledata).then((res) => {
            saleList.value = res.data.data
        })
    })
}
// 获取弹窗列表
const addData = {
    token: store.token,
    page: '',
    rows: 20,
    PI_name: '',
    start_time: '',
    end_time: '',
    customer_info_id: '',
    Sales_User_ID: '',
    country_id: ''
}
const addList = ref([])
const getAddList = () => {
    addData.page = 1
    addData.Sales_User_ID = payAdd.value.sales
    pubAddRequest()
}
const pubAddRequest = () => {
    api.ordersConfigPaymentOrders(addData).then(res => {
        addList.value = res.data.data && res.data.data.map(item => {
            item.firstname = item.firstname && item.firstname.slice(0, 15)
            return item
        })
        addList.value = addList.value.filter(item => item.State !== 'Paid')
    })
}
// 上拉刷新
const arrlength = ref(1)
const getAddList1 = () => {
    if (addList.value.length === 0 || arrlength.value == 0) {
        return false
    }
    addData.page = addData.page + 1
    console.log(arrlength.value)
    api.ordersConfigPaymentOrders(addData).then(res => {
        arrlength.value = res.data && res.data.length
        if (arrlength.value == 0) return false
        addList.value = [
            ...addList.value,
            ...res.data.data && res.data.data.map(item => {
                item.firstname = item.firstname && item.firstname.slice(0, 15)
                return item
            })]
    })
}
// 根据时间筛选列表
const dategetAddList = (val) => {
    if (saveState.value == 'edit') {
        addData.Sales_User_ID = SalesID.value
    } else {
        addData.Sales_User_ID = payAdd.value.sales
    }
    if (!!val) {
        addData.page = 1
        addData.start_time = utils.ftime(new Date(val[0]).getTime())
        addData.end_time = utils.ftime(new Date(val[1]).getTime())
    } else {
        addData.page = 1
        addData.start_time = ''
        addData.end_time = ''
    }
    pubAddRequest()
}
// 根据ID名搜索列表
const seachName = (val) => {
    if (saveState.value == 'edit') {
        addData.Sales_User_ID = SalesID.value
    } else {
        addData.Sales_User_ID = payAdd.value.sales
    }
    addData.page = 1
    addData.PI_name = val
    utils.debounce(1000, () => {
        pubAddRequest()
    })
}
// 根据国家搜索列表
const changecountry = (val) => {
    if (saveState.value == 'edit') {
        addData.Sales_User_ID = SalesID.value
    } else {
        addData.Sales_User_ID = payAdd.value.sales
    }
    addData.page = 1
    addData.country_id = val
    pubAddRequest()
}

// 根据客户搜索列表
const changUser = (val) => {
    if (saveState.value == 'edit') {
        addData.Sales_User_ID = SalesID.value
    } else {
        addData.Sales_User_ID = payAdd.value.sales
    }
    addData.page = 1
    addData.customer_info_id = val
    pubAddRequest()
}
const rightList = ref([])
const SelectionMethod = (val) => {
    if (saveState.value == 'edit') {
        rightList.value = [
            ...rightList.value,
            ...val
        ]
    } else {
        rightList.value = val
    }
    rightList.value.map(item => {
        item.inputNumber = item.amount
        return item
    })
    calculatePrice()
}
// 右侧列表更改价格计算总和和结余
const itemInpuAmount = () => {
    utils.debounce(500, () => {
        calculatePrice()
    })

}
// 列表item删除方法
const del = (val) => {
    rightList.value.splice(val.$index, 1)
}
/************************************编辑********************************/
const payEditData = {
    token: store.token,
    payment_id: ''
}
const SalesID = ref('')
const payment_id = ref('')
const payment_check_id = ref('')
const conutryId = ref('')
const payEdit = (val) => {
    payEditData.payment_id = val.row.Payment_id
    payment_id.value = val.row.Payment_id
    payAdd.value = {}
    rightList.value = []
    addList.value = []
    api.paymentEdit(payEditData).then(res => {
        rightList.value = res.data.orders && res.data.orders.map(item => {
            item.firstname = ''
            item.amount = item.Paied
            item.inputNumber = item.Paied
            return item
        })
        payment_check_id.value = res.data.payment.payment_check_id
        // 编辑状态的保存下拉框id
        SalesID.value = res.data.payment.Sales_User_ID
        conutryId.value = res.data.payment.Country_id
        // 编辑状态的保存一般输入框数据
        payAdd.value.amount = res.data.payment.Amount
        payAdd.value.sales = res.data.payment.sale_name
        payAdd.value.date = res.data.payment.ReceiveTime
        payAdd.value.paymentWay = res.data.payment.Payment_way
        payAdd.value.currency = res.data.payment.Current
        payAdd.value.paytype = res.data.payment.payment_type
        payAdd.value.country = res.data.payment.country_name
        payAdd.value.bankID = res.data.payment.Payment_account_config
        payAdd.value.rate = res.data.payment.received_rate
        payAdd.value.fee = res.data.payment.fee
        payAdd.value.remarks = res.data.payment.comments
        payAdd.value.total = rightList.value.reduce((sum, item) => { return sum + item.inputNumber * 1 }, 0) + payAdd.value.fee * 1
        payAdd.value.balance = payAdd.value.amount - payAdd.value.total
        addData.Sales_User_ID = res.data.payment.Sales_User_ID
        pubAddRequest()
    })
    addOne.value.open = true
    saveState.value = 'edit'
}
/***
 *弹窗保存方法
 *saveState：open->添加，edit->编辑
 */
const addSave = () => {
    const addSaveData = {
        token: store.token,
        payment_id: '',
        payment_check_id: '',
        Sales_User_ID: '',
        country_id: '',
        payment_way: payAdd.value.paymentWay,
        config_id: payAdd.value.bankID,
        Amount: payAdd.value.amount,
        Current: payAdd.value.currency,
        ReceiveTime: utils.ftime(payAdd.value.date),
        received_rate: payAdd.value.rate,
        payment_type: payAdd.value.paytype,
        fee: payAdd.value.fee,
        comments: payAdd.value.remarks,
        orders: []
    }
    if (saveState.value == 'open') {
        addSaveData.Sales_User_ID = payAdd.value.sales
        addSaveData.country_id = payAdd.value.country
        addSaveData.orders = rightList.value.map(item => {
            return {
                "Paied": item.inputNumber,
                "order_id": item.order_id
            }
        })
        api.paymentAdd(addSaveData).then(res => {
            if (res.Status == 0) {
                addOne.value.open = false
                bankID.value = payAdd.value.bankID
                getEntryList()
                for (let key in payAdd.value) {
                    payAdd.value[key] = ''
                }
                ElMessage({
                    type: 'success',
                    message: 'Add successfully',
                })
            }
        })
    } else if (saveState.value == 'edit') {
        addSaveData.payment_id = payment_id.value
        addSaveData.payment_check_id = payment_check_id.value
        addSaveData.Sales_User_ID = typeof (payAdd.value.sales) == 'string' ? SalesID.value : payAdd.value.sales
        addSaveData.country_id = typeof (payAdd.value.country) == 'string' ? conutryId.value : payAdd.value.country
        addSaveData.orders = rightList.value.map(item => {
            return {
                "payment_order_id": item.Payment_order_id ? item.Payment_order_id : '',
                "Paied": item.inputNumber,
                "order_id": item.order_id
            }
        })
        api.paymentSaveEdit(addSaveData).then(res => {
            if (res.Status == 0) {
                addOne.value.open = false
                bankID.value = payAdd.value.bankID
                getEntryList()
                for (let key in payAdd.value) {
                    payAdd.value[key] = ''
                }
                addList.value = []
                rightList.value = []
                ElMessage({
                    type: 'success',
                    message: 'Edit successfully',
                })
            }
        })
    }
}
/***********************************弹窗结束 **************************************/
/***********************************导出记录开始 ***********************************/
const exportFile = (header, columns, dataList, expertName) => {
    const EXCEL_TYPE =
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
    const workbook = new Excel.Workbook()
    workbook.created = new Date()
    workbook.modified = new Date()
    const worksheet = workbook.addWorksheet('PatmentExcel')
    worksheet.properties.defaultColWidth = 20
    worksheet.columns = columns
    worksheet.getRow(1).values = header
    worksheet.addRows(dataList)
    workbook.xlsx.writeBuffer().then((buffer) => {
        const blob = new Blob([buffer], { type: EXCEL_TYPE })
        saveAs(blob, `${expertName}.xlsx`)
    })
}
const download = () => {
    const header = ['Date', 'Name', 'SalesName', 'CreateName', 'Currency', 'Amount', 'Bank', 'Comment']
    const columns = header.map((item) => {
        return {
            header: item,
            key: item,
        }
    })
    const exportList = entryList.value.map(item => {
        return {
            'Date': item.ReceiveTime,
            'Name': item.PI_name,
            'SalesName': item.user_name,
            'CreateName': item.create_name,
            'Currency': item.Current,
            'Amount': item.Amount,
            'Bank': item.config_short,
            'Comment': item.comments
        }
    })
    exportFile(header, columns, exportList, `${utils.ftime(new Date().getTime())}`)
}
/***********************************导出记录结束 ***********************************/
onMounted(() => {
    getBankList()
    getAddInfo()
})
</script>
<style lang="less" >
@import url(./payment.less);
</style>